<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>updateVideo</title>

    <script src="${pageContext.request.contextPath}/js/jquery-1.12.4.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/confirm.js"></script>
	<script src="${pageContext.request.contextPath}/js/jquery.validate.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/message_cn.js"></script>
	<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>
    
    <nav class="navbar navbar-inverse" style="margin-bottom:0px;">
     <div class="container">
     
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          
          <a class="navbar-brand" href="videoList.action">视频管理项目</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
          <ul class="nav navbar-nav">
            <li class="active"><a href="videoList.action">视频管理</a></li>
            <li><a href="speakerList.action">主讲人管理</a></li>
            <li><a href="courseList.action">课程管理</a></li>
          </ul>
          
          <p class="navbar-text navbar-right"><span>${sessionScope.userName }</span><i class="glyphicon glyphicon-log-in"></i>
            <a href="${pageContext.request.contextPath}/admin/exit.action" class="navbar-link">退出</a>
          </p>
        </div><!-- /.navbar-collapse -->
       </div>
      </div><!-- /.container-fluid -->
    </nav>
    <div class="jumbotron" style="margin-top:0px;padding-top:7px;padding-bottom:7px;">
	    <div class="container" >
	    
	    <c:if test="${empty video.id}">
	       <h2>添加视频信息</h2>
	    </c:if>
	    <c:if test="${not empty video.id}">
	    	<h2>修改视频信息</h2>
	    </c:if>
	    </div>
	</div>
	
	<div class="container">
	    <form class="form-horizontal" action="saveOrUpdateVideo.action" method="post">
	    	<input type="hidden" name="id" value="${video.id }">
			   <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">视频标签</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputPassword3"  name="title" value="${video.title }"  placeholder="视频标签">
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">主讲人</label>
			    <div class="col-sm-10">
			      <select class="form-control" name = "spearkerId">
					  <option value="0">请选择讲师</option>
					   <c:forEach items="${speakerList}" var="speaker">
					      
					      <option value="${speaker.id}" 
					        
					             <c:if test="${speaker.id==video.spearkerId}">selected</c:if>
					         
					       >${speaker.speakerName}</option>
					   </c:forEach>
					</select>
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">所属课程</label>
			    <div class="col-sm-10">
			      	<select class="form-control" name="courseId">
						  <option value="0">请选择所属课程</option>
						  <c:forEach items="${courseList }" var="course">
						  		<option value="${course.id }"
						  			<c:if test="${course.id==video.courseId }">selected</c:if>
						  		>${course.courseTitle }
						  </c:forEach>
					</select>
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">视频时长(秒)</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputPassword3" name="time" value="${video.time }" placeholder="精确到秒(正整数)">
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">封面图片地址</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputPassword3"  name="imageUrl" value="${video.imageUrl }"  placeholder="具体的url">
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">视频播放地址</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputPassword3" name="videoUrl" value="${video.videoUrl }"  placeholder="具体的url">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">备注</label>
			    <div class="col-sm-10">
			      <textarea class="form-control" rows="3" name="detail">${video.detail }</textarea>
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button type="submit" class="btn btn-default">保存</button>
			    </div>
			  </div>
			</form> 
	</div>
  </body>
</html>